package com.cgw.dmplt.address.dao.ibatis;

import java.util.List;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import com.cgw.dmplt.address.domain.City;
import com.cgw.dmplt.address.dao.CityDao;

/**
 *
 */
public class CityDaoImpl extends SqlMapClientDaoSupport implements CityDao
{
    
    /**
     * insert.
     * @param city city
     * @return id
     */
    public String insertCity(City city){
    	getSqlMapClientTemplate().insert("City_insertCity", city);
    	return null;
    }

    /**
     * delete.
     * @param city city
     */
    public void deleteCity(City city) {
        getSqlMapClientTemplate().update("City_deleteCity", city);
    }
    
    /**
     * update.
     * @param city city
     */
    public void updateCity(City city){
    	getSqlMapClientTemplate().update("City_updateCity", city);
    }
    
    /**
     * find.
     * @param id id
     * @return city
     */
    public City findCity(Integer pk){
        City city = (City) getSqlMapClientTemplate().queryForObject("City_findCity", pk);
        return city;
    }
    
    /**
     * list.
     * @param city city
     * @return city list
     * @throws DataAccessException DataAccessException
     */
    public List listCity(City city){
        List list = getSqlMapClientTemplate().queryForList("City_listCity", city);
        return list;
    }  
    
    /**
     * listCount.
     * @param city city
     * @return list count
     */
    public Integer listCityCount(City city){
        Integer count = (Integer)getSqlMapClientTemplate().queryForObject("City_listCityCount", city);
        return count;
    }  
}
